package ace.module.captcha.sdk.core.feign.impl;

import ace.cmp.core.model.R;
import ace.cmp.openfeign.security.oauth2.core.config.FeignInternalServerOauth2SecurityConfig;
import ace.module.captcha.api.model.dto.CaptchaApplicationDto;
import ace.module.captcha.sdk.core.constant.SdkConstant;
import ace.module.captcha.sdk.core.feign.CaptchaApplicationFeignApi;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 图形验证码应用 rpc feign.
 *
 * @author Caspar
 */
@FeignClient(
    name = "${spring.cloud.openfeign.client.config.captchaApplicationFeign.name:" + SdkConstant.FEIGN_SERVICE_NAME + "}",
    contextId = "captchaApplicationFeign",
    path = CaptchaApplicationFeign.PATH,
    configuration = FeignInternalServerOauth2SecurityConfig.class,
    primary = false
)
public interface CaptchaApplicationFeign extends CaptchaApplicationFeignApi {

  String PATH = "${spring.cloud.openfeign.client.config.captchaApplicationFeign.path:/captcha/captcha-application/rpc}";

  @GetMapping("/getByKey")
  R<CaptchaApplicationDto> getByKey(@RequestParam("key") String key);

  @GetMapping("/getAndCheckNotNullAdminApplication")
  R<CaptchaApplicationDto> getAndCheckNotNullAdminApplication();
}
